#{extends 'logged_user.html' /}
#{set title:'Your Handshakes' /}
<h3>My Handshakes</h3>
#{if handshakes}
<table style="width:92%">
  <tr>
    <th>Title</th>
    <th>Owner</th>
    <th>Social Credits</th>
    <th>Status</th>
    <th>Feedback</th>
    <th>Details</th>
  </tr>
  #{list items:handshakes, as:'handshake'}
  <tr>
      <td>
	<a href="@{Handshakes.show(handshake.id)}">
	${handshake.title}
	</a>
      </td>
      <td>
	<a href="@{Users.profile(handshake.owner.id)}">${handshake.owner.fullname}</a>
      </td>
      <td>${handshake.getCredits().forOfferer()}</td>
      <td>${handshake.status.toString().toLowerCase()}</td>
      #{if handshake.status != handshake.status.CREATED && handshake.status != handshake.status.HANDSHAKED }
      <td><a href="@{Handshakes.feedback(handshake.id)}">Feedback</a></td>
      #{/if}
      #{else}
      <td></td>
      #{/else}
      #{if handshake.getClass() == models.Offer.class}
      <td><a href="@{Offers.showDetails(handshake.id)}">Details</a></td>
      #{/if}
      #{else}
      <td><a href="@{Requests.showDetails(handshake.id)}">Details</a></td>
      #{/else}
      
  </tr>
</a>
#{/list}
</table>
#{/if}
#{else}
<p>Currently you have no handshakes.</p>
#{/else}
